package com.yanq.liancar.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.TextView;

import com.yanq.liancar.R;
import com.yanq.liancar.activity.base.BaseToolbarActivity;
import com.yanq.liancar.adapter.SeeServiceImgAdapter;
import com.yanq.liancar.bean.FullServiceBean;
import com.yanq.liancar.util.Utils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SmallBSeeServiceActivity extends BaseToolbarActivity {
    @BindView(R.id.tv_service_type)
    TextView tvServiceType;
    @BindView(R.id.tv_service_name)
    TextView tvServiceName;
    @BindView(R.id.tv_service_price)
    TextView tvServicePrice;
    @BindView(R.id.tv_service_matter)
    TextView tvServiceMatter;
    @BindView(R.id.tv_service_profile)
    TextView tvServiceProfile;
    @BindView(R.id.img_gridview)
    GridView imgGridview;
    private List<FullServiceBean.DataBean.FilesBean> imglist;
    private SeeServiceImgAdapter serviceImgAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_small_b_seeservice);
        Utils.setStatusBar(this, true,false);
        ButterKnife.bind(this);

        mTvTitle.setText("查看服务");

        FullServiceBean.DataBean dataBean= (FullServiceBean.DataBean) getIntent().getSerializableExtra("BSreviceAdmBean");
        if (dataBean.getServiceType()==80) {
            tvServiceType.setText("快速精洗");
        }else if (dataBean.getServiceType()==90){
            tvServiceType.setText("精准精洗");
        }else if(dataBean.getServiceType()==2){
            tvServiceType.setText("标准洗车");
        }else if (dataBean.getServiceType()==3){
            tvServiceType.setText("美容养护");
        }else if (dataBean.getServiceType()==4){
            tvServiceType.setText("到店保养");
        }else if (dataBean.getServiceType()==5){
            tvServiceType.setText("钣金喷漆");
        }else {
            tvServiceType.setText("代办服务");
        }
        tvServiceName.setText(dataBean.getServiceName());
        tvServicePrice.setText("¥"+dataBean.getServicePrice());
        tvServiceMatter.setText(dataBean.getServiceRemark());
        imglist=dataBean.getFiles();
        tvServiceProfile.setText(dataBean.getServiceInfo());
        addImg();
    }

    private void addImg() {
        serviceImgAdapter = new SeeServiceImgAdapter(mContext, imglist);
        imgGridview.setAdapter(serviceImgAdapter);
        imgGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            }
        });
    }
}
